﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;

namespace MCPlatform.UI.Controls.Converts
{
    public class CellContentToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            // 将单元格的内容转换为对应的颜色
            if (value != null)
            {
                TextBlock? textBlock = value as TextBlock;
                string? content = textBlock?.Text;
                switch (content)
                {
                    case "Passed":
                        return Brushes.Green;
                    case "Failed":
                        return Brushes.Red;
                    case "Busy":
                        return Brushes.Yellow;
                    default:
                        return Brushes.Transparent; // 默认透明
                }
            }
            return Brushes.Transparent; // 默认透明
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
